<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'righttree.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.4.5/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.4.5/themes/default/easyui.css">
    <script type="text/javascript" src="js/jquery-easyui-1.4.5/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery-easyui-1.4.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="js/jquery-easyui-1.4.5/locale/easyui-lang-zh_CN.js"></script>

  	<script type="text/javascript">
 		$(function(){
 			$("#sub").click(function(){
 				//选择的节点的数据，还要加上他父节点的数据
 				var noteid=$("#tt").tree("getChecked",['checked','indeterminate']);
 				//alert(noteid);
 				var ids="";
 				//alert(noteid.length);
 				for(var i=0;i<noteid.length;i++){
 					if(ids==""){
 						ids=ids+noteid[i].ri_id;
 					}
 					else{
 						ids=ids+",";
 						ids=ids+noteid[i].ri_id;
 					}
 				}
 				//alert(ids);
 				$("#id").val(ids);
 				$("#formxx").submit();
 			});
 		});
  	
  	</script>
  </head>
  
  <body>
  <form action="role/add.action" method="post" id="formxx" >
 	 <input type="hidden" name="ids" id="id"/>
	  角色名：<input type="text" name="ro_name"/>
	  <div>
	  <h4>赋予角色权限</h4>
	    <ul id="tt" class="easyui-tree" data-options="url:'right/list.action',checkbox:true"></ul>
	  </div>  
	  <input type="button" id="sub" value="提交"/>
  </form>
  </body>
</html>
